package com.woniu.sso_jwt.jwtuser;

import javax.sound.midi.Soundbank;
import java.util.HashMap;
import java.util.Map;
//模拟数据，提供模拟数据
public class JWTUsers  {
    //定义map,初始化时产生十个用户
    private static final Map<String,String> Users=new HashMap<>();
    static{
        for(int i=0;i<10;i++){
            Users.put("admin"+i,"password"+i);
        }
    }

    //验证是否可登录
    public static boolean isLogin( String username,String password){
        if(username==null||username.trim().length()==0){
            return false;
        }

        System.out.println(username);
        String obj=Users.get(username);
        System.out.println(obj);
        if(obj==null||!obj.equals(password)){
            return false;
        }

        return true;
    }
}
